import os
# 打开文件
with open('test1.txt', mode='a', encoding='utf-8') as f:
    # 写入文件内容
    f.write('\n今天的天气很好!\n')
    f.writelines(['你好，你是谁？\n', '我是jay\n'])  # f.writelines要将内容放入列表中
    content = ['你好，我是jay\n', '很高兴认识你\n']
    for i in content:
        f.write(i)

with open('test1.txt', mode='r', encoding='utf-8') as f:  # 相对路径
    content = f.read()
    print(content)
